package com.zhengqing.design.action.visitor._01;

import com.zhengqing.design.action.visitor._01.computer.impl.Computer;
import com.zhengqing.design.action.visitor._01.computer.impl.Keyboard;
import com.zhengqing.design.action.visitor._01.computer.impl.Mouse;

/**
 * <p> 定义访问者类的操作 </p>
 *
 * @author zhengqingya
 * @description
 * @date 2022/12/22 12:01
 */
public interface ComputerPartVisitor {
    void visit(Mouse mouse);

    void visit(Keyboard keyboard);

    void visit(Computer computer);
}

class ComputerPartDisplayVisitor implements ComputerPartVisitor {
    @Override
    public void visit(Mouse mouse) {
        System.out.println("Displaying Mouse.");
    }

    @Override
    public void visit(Keyboard keyboard) {
        System.out.println("Displaying Keyboard.");
    }

    @Override
    public void visit(Computer computer) {
        System.out.println("Displaying Computer.");
    }
}